/**
 * Created by guomin on 2017/5/31.
 */
var Promise = require('bluebird');
var db = require('../conf/mongodb');

var getData = {
  getAppInfoByAppId: function (appId) {
    return new Promise(function (resolve, reject) {
      db.users.findOne({appId: appId}).then(function (data) {
        console.log("usersInfoByAppId:_______", data);
        if (data != null) {
          if (data.status != '1') {
            reject(-22);
          } else {
            resolve(data);
          }
        } else {
          reject(-21);
        }
      }).catch(function (err) {
        reject(err);
      })
    });
  }
};

exports = module.exports = getData;